namespace WebApi.Data.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    using WebApi.Model;

    internal sealed class Configuration : DbMigrationsConfiguration<WebApi.Data.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(WebApi.Data.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
            context.Movies.AddOrUpdate(x => x.MovieId,
                new Movie() { MovieId = 1, Title = "Star Wars IV", Director = "George Lucas", Rating = Rating.PG },
                new Movie() { MovieId = 2, Title = "Star Wars V", Director = "George Lucas", Rating = Rating.G },
                new Movie() { MovieId = 3, Title = "Star Wars VI", Director = "George Lucas", Rating = Rating.PG13 },
                new Movie() { MovieId = 4, Title = "Star Wars III", Director = "George Lucas", Rating = Rating.R }
                );
        }
    }
}